﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JacOS.Programs
{
    class cd
    {
        public static void run(string tempPath = "")
        {
            if (tempPath == "")
            {
                Console.Write("\n" + MyGlobals.Path);
            }
            else
            {
                //Check if the desired directory is higher than their login rights
                if (tempPath == "D:\\Jcoder\\" && MyGlobals.current_level < 4)
                {
                    //If not than say so and do nothing
                    Console.Write("You have no permissions");
                }
                else if (tempPath == "D:\\Vcoder\\" && MyGlobals.current_level < 4)
                {
                    Console.Write("You have no permissions");
                }
                else if (tempPath == "D:\\Admin\\" && MyGlobals.current_level < 3)
                {
                    Console.Write("You have no permissions");
                }
                else if (tempPath == "D:\\GenUser\\" && MyGlobals.current_level < 2)
                {
                    Console.Write("\nYou have no permissions");
                }
                //If everything checks out than procede as planned
                else
                {
                    //Set the path as what the user typed;
                    MyGlobals.Path = tempPath;
                }
            }
        }
    }
}
